chrome.runtime.onInstalled.addListener(({ reason }) => {
  if (reason === 'install') {
    console.log('install')
  } else if (reason === 'update') {
    console.log('update')
  }
})

chrome.storage.onChanged.addListener((changes, namespace) => {
  for (let [key, { oldValue, newValue }] of Object.entries(changes)) {
    console.log(
      `Storage key "${key}" in namespace "${namespace}" changed.`,
      `Old value was "${oldValue}", new value is "${newValue}".`,
    )
  }
})
